package IC.SymbolTables.Types;

public class ArrayType extends InstanceType
{
	private InstanceType _elemType;
	
	public ArrayType(InstanceType elemType) { _elemType = elemType; }
	
	public boolean IsInstanceOf(Type type)
	{
		return ((type instanceof ArrayType) && ((ArrayType)type)._elemType.equals(_elemType));
	}
	
	public InstanceType GetInerType() { return _elemType; }
	
	public static InstanceType Dimensionlize(int dimension, IC.SymbolTables.Types.InstanceType type)
	{	
		for (int i = 0; i < dimension; i++)
			type = new IC.SymbolTables.Types.ArrayType(type);
		
		return type;
	}
	
	public String toString() { return _elemType.toString() + "[]"; }
}
